package com.cattsoft.ssm.component;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.cattsoft.ssm.entity.User;
import com.cattsoft.ssm.entity.UserVo;
import com.cattsoft.ssm.persistence.UserMapper;

public class UserComponent {
	private UserMapper userMapper;
	
	public UserMapper getUserMapper() {
		return userMapper;
	}
	public void setUserMapper(UserMapper userMapper) {
		this.userMapper = userMapper;
	}
	public User login(UserVo userVo) {
		System.out.println("执行login（）     ");
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
		UserMapper userMapper = (UserMapper) ctx.getBean("userMapper");
		User user1 = userMapper.login(userVo);
		System.out.println(user1);
		return user1;
	}
	
}
